import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Popconfirm,Icon } from 'antd'

/***
 * VED view edit delete
 */
export default class extends Component {
    static propTypes = {
        onView: PropTypes.func,
        onEdit: PropTypes.func,
        onDel: PropTypes.func,
        renderAddtionalEl: PropTypes.func
    }

    constructor(props) {
        super(props)
    }
    render = () => {
        const {onView, onEdit, onDel, renderAddtionalEl} = this.props
        return (
            <span>
                <a onClick={onView}><span>查看</span></a>
                <span className="ant-divider" />
                <a onClick={onEdit}><span>修改</span></a>
                <span className="ant-divider" />
                <Popconfirm title="确认删除?" onConfirm={onDel}>
                    <a><span>删除</span></a>
                </Popconfirm>
                {
                    renderAddtionalEl && renderAddtionalEl()
                }
            </span>
        )
    }
}
